package com.basic;


import com.frame.struts.BaseBean;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;
import com.utils.*;
import java.util.Date;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class OwnerFamilyForm extends BaseBean {
    public OwnerFamilyForm() {
    }
	OwnerFamilyEntity ofe = new OwnerFamilyEntity();
	private String oldId = "";
	public String addOwnerFamily(){
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		//String qyid = (String) request.getSession().getAttribute("session_qyid");
		//hre.setQyid(qyid);
		ofe.setOptdate(new Date());
		ofe.setOptrid(CommUtil.getUserId(request));
		try{
			if (factory.addOwnerFamily(ofe)) {
				//System.out.println("wo zhi xing le!");
				response.sendRedirect("/basic/queryFaRenJiaZhuQiYe.jsp");
				return "success";
			}
			response.sendRedirect("/basic/failed.jsp");
		}catch(Exception e){
			System.err.println(e.getMessage());
		}
		return "failed";
	}
	public String modifyOwnerFamily(){
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		//String qyid = (String) request.getSession().getAttribute("session_qyid");
		//hre.setQyid(qyid);
		ofe.setOptdate(new Date());
		ofe.setOptrid(CommUtil.getUserId(request));
		factory.deleteOwnerFamily(ofe.getRyid(),this.getOldId());
		try{
			if (factory.addOwnerFamily(ofe)) {
				//System.out.println("wo zhi xing le!");
				response.sendRedirect("/basic/queryFaRenJiaZhuQiYe.jsp");
				return "success";
			}
			response.sendRedirect("/basic/failed.jsp");
		}catch(Exception e){
			System.err.println(e.getMessage());
		}
		return "failed";

	}

	public String getOldId(){
		return this.oldId;
	}
	public void setOldId(String oldId){
		this.oldId=oldId;
	}
	/**
	 * @return ofe.getReturns the jzgx.
	 */
	public String getJzgx() {
		return ofe.getJzgx();
	}
	/**
	 * @param jzgx The jzgx to set.
	 */
	public void setJzgx(String jzgx) {
		ofe.setJzgx(jzgx);
	}
	/**
	 * @return ofe.getReturns the optdate.
	 */
	public Date getOptdate() {
		return ofe.getOptdate();
	}
	/**
	 * @param optdate The optdate to set.
	 */
	public void setOptdate(Date optdate) {
		ofe.setOptdate(optdate);
	}
	/**
	 * @return ofe.getReturns the optrid.
	 */
	public String getOptrid() {
		return ofe.getOptrid();
	}
	/**
	 * @param optrid The optrid to set.
	 */
	public void setOptrid(String optrid) {
		ofe.setOptrid(optrid);
	}
	/**
	 * @return ofe.getReturns the qymc.
	 */
	public String getQymc() {
		return ofe.getQymc();
	}
	/**
	 * @param qymc The qymc to set.
	 */
	public void setQymc(String qymc) {
		ofe.setQymc(qymc);
	}
	/**
	 * @return ofe.getReturns the recstate.
	 */
	public String getRecstate() {
		return ofe.getRecstate();
	}
	/**
	 * @param recstate The recstate to set.
	 */
	public void setRecstate(String recstate) {
		ofe.setRecstate(recstate);
	}
	/**
	 * @return ofe.getReturns the remark.
	 */
	public String getRemark() {
		return ofe.getRemark();
	}
	/**
	 * @param remark The remark to set.
	 */
	public void setRemark(String remark) {
		ofe.setRemark(remark);
	}
	/**
	 * @return ofe.getReturns the ryid.
	 */
	public int getRyid() {
		return ofe.getRyid();
	}
	/**
	 * @param ryid The ryid to set.
	 */
	public void setRyid(int ryid) {
		ofe.setRyid(ryid);
	}
	/**
	 * @return ofe.getReturns the sfzhm.
	 */
	public String getSfzhm() {
		return ofe.getSfzhm();
	}
	/**
	 * @param sfzhm The sfzhm to set.
	 */
	public void setSfzhm(String sfzhm) {
		ofe.setSfzhm(sfzhm);
	}
	/**
	 * @return ofe.getReturns the xh.
	 */
	public int getXh() {
		return ofe.getXh();
	}
	/**
	 * @param xh The xh to set.
	 */
	public void setXh(int xh) {
		ofe.setXh(xh);
	}
	/**
	 * @return ofe.getReturns the xm.
	 */
	public String getXm() {
		return ofe.getXm();
	}
	/**
	 * @param xm The xm to set.
	 */
	public void setXm(String xm) {
		ofe.setXm(xm);
	}
	/**
	 * @return ofe.getReturns the zzjgdm.
	 */
	public String getZzjgdm() {
		return ofe.getZzjgdm();
	}
	/**
	 * @param zzjgdm The zzjgdm to set.
	 */
	public void setZzjgdm(String zzjgdm) {
		ofe.setZzjgdm(zzjgdm);
	}

}